﻿function deleteFollowedAuction(followedAuctionId) {
    var data2Send = { "followedAuctionId": followedAuctionId };
    $('#errorFollowedAuctionsDiv').html("");
    $.ajax({
        type: "POST",
        url: '/Auction/DeleteFollowedAuction',
        data: JSON.stringify(data2Send),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data) { //call successfull
            if (data.isOK == -1) {
                $('#errorFollowedAuctionsDiv').html("Không tồn tại");
            } else if (data.isOK == 1) {
                $('#errorFollowedAuctionsDiv').html("Lỗi");
            } else {
                $('#followedAuctionItem' + followedAuctionId).remove();
            }
            setInterval(function () { $("#errorFollowedAuctionsDiv").html(""); }, 3000);
        },
        error: function (xhr) {
            //error occurred
        }
    });
}